package com.ly.heart.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.SecurityUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import com.ly.heart.mapper.KingBaseReceiptConditionDetailMapper;
import com.ly.heart.service.IKingBaseReceiptConditionDetailService;
import com.ly.heart.util.CurrentUserUtil;
import org.springframework.stereotype.Service;
import com.ly.heart.domain.KingBaseReceiptConditionDetailEntity;

import javax.annotation.Resource;

/**
 * 金蝶-基础数据-收款条件/付款条件规则明细Service业务层处理
 * @author wutao
 * @date 2024-06-26
 */
@Service
public class KingBaseReceiptConditionDetailServiceImpl extends ServiceImpl<KingBaseReceiptConditionDetailMapper, KingBaseReceiptConditionDetailEntity> implements IKingBaseReceiptConditionDetailService {

    @Resource
    private KingBaseReceiptConditionDetailMapper kingBaseReceiptConditionDetailEntityMapper;

    /**
     * 查询金蝶-基础数据-收款条件/付款条件规则明细
     * @param id 金蝶-基础数据-收款条件/付款条件规则明细ID
     * @return 金蝶-基础数据-收款条件/付款条件规则明细
     */
    @Override
    public KingBaseReceiptConditionDetailEntity selectKingBaseReceiptConditionDetailEntityById (String id) {
        return kingBaseReceiptConditionDetailEntityMapper.selectKingBaseReceiptConditionDetailEntityById ( id );
    }

    /**
     * 查询金蝶-基础数据-收款条件/付款条件规则明细列表
     * @param kingBaseReceiptConditionDetailEntity 金蝶-基础数据-收款条件/付款条件规则明细
     * @return 金蝶-基础数据-收款条件/付款条件规则明细
     */
    @Override
    public List<KingBaseReceiptConditionDetailEntity> selectKingBaseReceiptConditionDetailEntityList (KingBaseReceiptConditionDetailEntity kingBaseReceiptConditionDetailEntity) {
        List<KingBaseReceiptConditionDetailEntity> conditionDetailEntities = kingBaseReceiptConditionDetailEntityMapper.selectKingBaseReceiptConditionDetailEntityList ( kingBaseReceiptConditionDetailEntity );
        return conditionDetailEntities;
    }

    /**
     * 新增金蝶-基础数据-收款条件/付款条件规则明细
     * @param kingBaseReceiptConditionDetailEntity 金蝶-基础数据-收款条件/付款条件规则明细
     * @return 结果
     */
    @Override
    public int insertKingBaseReceiptConditionDetailEntity (KingBaseReceiptConditionDetailEntity kingBaseReceiptConditionDetailEntity) {
        kingBaseReceiptConditionDetailEntity.setId ( SnowflakeIdWorker.getInstance ().nextStringId () );
        kingBaseReceiptConditionDetailEntity.setDeptId ( CurrentUserUtil.getCompanyId () );
        kingBaseReceiptConditionDetailEntity.setCreateBy ( SecurityUtils.getLoginUser ().getUser ().getUserId () );
        kingBaseReceiptConditionDetailEntity.setCreateTime ( DateUtils.getNowDate () );
        return kingBaseReceiptConditionDetailEntityMapper.insertKingBaseReceiptConditionDetailEntity ( kingBaseReceiptConditionDetailEntity );
    }

    /**
     * 修改金蝶-基础数据-收款条件/付款条件规则明细
     * @param kingBaseReceiptConditionDetailEntity 金蝶-基础数据-收款条件/付款条件规则明细
     * @return 结果
     */
    @Override
    public int updateKingBaseReceiptConditionDetailEntity (KingBaseReceiptConditionDetailEntity kingBaseReceiptConditionDetailEntity) {
        kingBaseReceiptConditionDetailEntity.setUpdateTime ( DateUtils.getNowDate () );
        return kingBaseReceiptConditionDetailEntityMapper.updateKingBaseReceiptConditionDetailEntity ( kingBaseReceiptConditionDetailEntity );
    }

    /**
     * 批量删除金蝶-基础数据-收款条件/付款条件规则明细
     * @param ids 需要删除的金蝶-基础数据-收款条件/付款条件规则明细ID
     * @return 结果
     */
    @Override
    public int deleteKingBaseReceiptConditionDetailEntityByIds (String[] ids) {
        return kingBaseReceiptConditionDetailEntityMapper.deleteKingBaseReceiptConditionDetailEntityByIds ( ids );
    }

    /**
     * 删除金蝶-基础数据-收款条件/付款条件规则明细信息
     * @param id 金蝶-基础数据-收款条件/付款条件规则明细ID
     * @return 结果
     */
    @Override
    public int deleteKingBaseReceiptConditionDetailEntityById (String id) {
        return kingBaseReceiptConditionDetailEntityMapper.deleteKingBaseReceiptConditionDetailEntityById ( id );
    }
}
